home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0058_VGA COLOR Unit.pas < prev    next >
Pascal/Delphi Source File  |  1993-08-27  |  1KB  |  57 lines

  1. {
  2. PETER WOKKE
  3.  
  4. > anyone know a way to set the DAC registers that's faster than int $10?
  5. }
  6.  
  7. PROGRAM vga_in_mode_13;
  8.  
  9. { VGA in Mode $13  320 x 200 and 256 Colors for Turbo Pascal 6.0 }
  10.  
  11. USES
  12.   Dos, Crt;
  13.  
  14. Procedure Plot(x, y : Integer; color : Byte);
  15. Begin
  16.   Mem[$A000 : word(y * 320 + x)] := color;
  17. End;
  18.  
  19. Procedure set_rgb(reg, Red, Green, Blue : Byte);
  20. Begin
  21.   Port[$3C8] := reg;
  22.   Inline($FA);
  23.   Port[$3C9] := Red;
  24.   Port[$3C9] := Green;
  25.   Port[$3C9] := Blue;
  26.   Inline($FB);
  27. End;
  28.  
  29. Var
  30.   x, y     : Integer;
  31.   reg      : Registers;
  32.   savemode : Byte;
  33.   n        : Byte;
  34. Begin
  35.   reg.AX := $0F00;
  36.   Intr($10, reg);
  37.   savemode := reg.al;
  38.  
  39.   reg.AX := $0013;
  40.   Intr($10, reg);
  41.  
  42.   For n := 0 TO 63 Do
  43.     set_rgb(n, n, 0, 0);
  44.   For n := 63 Downto 0 Do
  45.     set_rgb(127 - n, n, 0, 0);
  46.   For n := 128 TO 191 Do
  47.     set_rgb(n, 0, 0, n);
  48.  
  49.   For y := 0 TO 191 Do
  50.      For x := 0 TO 319 Do
  51.         Plot(x, y, y);
  52.   Readln;
  53.  
  54.   reg.AX := savemode;
  55.   Intr($10, reg);
  56. END.
  57.